﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

using CrystalDecisions.Windows.Forms;  


namespace test.time.test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int i = 10;
            this.label1.Text=myframework.time.数据库.Class1.do2();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //int i = 10;
            //this.label1.Text = myframework.time.数据库.Class1.do2();
            var dlg = new OpenFileDialog();
            if (dlg.ShowDialog() == DialogResult.OK) {
                CrystalReportViewer crv = new CrystalReportViewer();
                //crv.ReportSource = dlg.FileName;
                string s="server=DBJB0019\\ZR;database=erp;uid=sa;pwd=111111";
                DataSet ds=new DataSet();
                SqlConnection con=new SqlConnection(s);
                con.Open();
                string sql="select * from 品牌信息";
                SqlDataAdapter dap=new SqlDataAdapter(sql,con);
                dap.Fill(ds,"xinxi");


                ReportDocument doc = new ReportDocument();//不建议用CrystalReportSource的ReportDocument属性，后面说原因
                //doc.Load(dlg.FileName);//你建的水晶报表虚拟路径
                doc.SetDataSource(ds.Tables[0]);
                this.crystalReportViewer1.ReportSource = doc;
                 //CrystalReport

                //CrystalReport rpt = CrystalReportViewer1();
            }

        }
    }
}
